require(['../config/requireconfig'],function(config){
	//根据需要添加
	require(['zepto','common/mcommon','swiper'],function($,com,swiper){
        com.init();
		var pageLogic = new PageLogic($,com,swiper);
		pageLogic.init();

	});
});
var PageLogic = function($,com,Swiper){
	return{
		init:function(){
			var _this = this;
			var partsInfoId = com.utils().urlParam("partsInfoId");
			if(!partsInfoId || !$.trim(partsInfoId)){
				com.utils().windowJump("/");
			}
			_this.initHtml(partsInfoId);

		},
		initHtml:function(partsInfoId){
			var _this = this;
			com.ajax({
				url:"/partsCategoryDetailInfo.json",
				data:{parsInfoid:partsInfoId},
				success:function(res){
					_this.genHtml(res.data);
				}
			})
		},
		genHtml:function(prdInfo){
			var _this = this;
			_this.genBasicInfo(prdInfo.partInfo);
			_this.genPics(prdInfo.partImgs);
			_this.genItems(prdInfo.partItems);
			_this.genVedioInfo(prdInfo.partVedios);
		},
		genBasicInfo:function(partInfo){
			$(".con-title").html(partInfo.partsName);
			var html = "";
			if(partInfo.remarks){
				html += '<div class="con-title">产品简述</div>';
				html += '<div class="con-info">' + partInfo.remarks + '</div>';
			}
			if(partInfo.superior){
				html += '<div class="con-title">优势卖点</div>';
				html += '<div class="con-info">' + partInfo.superior + '</div>';
			}
			if(partInfo.maintain){
				html += '<div class="con-title">维修保养</div>';
				html += '<div class="con-info">' + partInfo.maintain + '</div>';
			}
			$(".prdRmks").html(html);
		},
		genPics:function(imgs){
			var html = "";
			$(imgs).each(function(){
				html += '<div class="swiper-slide banner-item">';
				html += ' <img src="' + com.Config.domain + this.imageUrl + '" >';
				html += '</div>';
			});
			$("#imgscon").html(html);
			var swiper = new Swiper('.prdimgs', {
				lazy: true,
			      pagination: {
			        el: '.swiper-pagination',
			      },
		    });
		},
		genItems:function(partItems){
			if(!partItems){
				return;
			}
			var html = "";
			$(partItems).each(function(){
				html += '<div class="prdItem"> ';
				html += '	<div class="prdItem-img"> ';
				html += '		<img src="' + com.Config.domain + this.imageUrl + '"> ';
				html += '		<div class="name">' + this.itemName + '</div> ';
				html += '	</div> ';
				html += '	<div class="prdItem-txt"> ';
				html += '		<div class="item-title">产品简述</div> ';
				html += '		<div class="item-detail">' + com.utils().htmldecode(this.remarks) + '</div> ';
				html += '	</div> ';
				html += '</div> ';
			});
			$(".prdItems").html(html);
		},
		genVedioInfo:function(vedioinfo){
			if(vedioinfo && vedioinfo.length > 0){
				$(".prdVedio").show();
			}
		}
	}
}